#ifndef MODELPOINT_H
#define MODELPOINT_H

#pragma once
#include "bllShape.h"

#include <list>
#include <vector>
using namespace std;

class modelPoint
{
public:
	modelPoint(void);
	~modelPoint(void);

	bool isInit(){return m_init;}

	void addShape()
	{
		list<POINT> lstPt;
		if(m_ptlist.size()>1)
		{
			if(m_ptlist[m_ptlist.size()-1].size()>=2)
				m_ptlist.push_back(lstPt);
		}
		else
		{
			m_ptlist.push_back(lstPt);
		}
	}

	void addPoint(POINT& pt)
	{
		if(m_init==false)
		{
			m_rectMax.left = pt.x;
			m_rectMax.top = pt.y;
			m_rectMax.right = pt.x;
			m_rectMax.bottom = pt.y;
			m_init = true;
		}

		if(pt.x < m_rectMax.left)
		{
			m_rectMax.left = pt.x;
		}
		if(pt.y < m_rectMax.top)
		{
			m_rectMax.top = pt.y;
		}
		if(pt.x > m_rectMax.right)
		{
			m_rectMax.right = pt.x;
		}
		if(pt.y > m_rectMax.bottom)
		{
			m_rectMax.bottom = pt.y;
		}
		
		m_ptlist[m_ptlist.size()-1].push_back(pt);
	}

	CRect getUpdateRect()
	{
		return m_rectMax;
	}

	vector<list<POINT>>& getData(){return m_ptlist;}
private:
	vector<list<POINT>> m_ptlist;
	CRect m_rectMax;
	bool m_init;
};


#endif
